Skip to content

Conversation

@rekibnikufesin
Copy link
Contributor

Adds the following checks:

  • verifies server is the datatrust
  • listing is a candidate (using event logs)
  • voting poll is still open
  • form parameters exist (parameter value not validated)

Listing candidate file asset is saved into s3_bucket/{public_key}/{listing_hash} to minimize name collisions.

@rekibnikufesin rekibnikufesin requested review from robrobbins and thirtyaughtsix and removed request for robrobbins and thirtyaughtsix August 13, 2019 16:55
@thirtyaughtsix
Copy link
Collaborator

Does weird shit happen if we send more than 1 file? The code allows for it but it looks like the data_hash will be of the last file. 🤷‍♂️

voteBy = evt['args']['voteBy']
if voteBy > int(time.time()):
owner = evt['args']['owner']
return owner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we recieve the transaction_hash from the client we can do 2 things:

  1. use web3.py to wait_for_transaciton_receipt (that way we know its mined)
  2. use protocol's voting_contract.is_candidate(hash)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question this raises is

should we implement twisted/celery/whatever to handle doing this in threads?

constants.CANDIDATE_ADDED,{'fromBlock':0,'toBlock':'latest'}
)
events = voting_filter.get_all_entries()
for evt in events:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can prob abstract out some log_helpers in datatrust

if event_hash == listing_hash:
log.info(f'Listing {listing_hash} has been listed as a candidate in protocol')
voteBy = evt['args']['voteBy']
if voteBy > int(time.time()):
Copy link
Contributor

@robrobbins robrobbins Aug 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also already a voting_contract.poll_closed(hash) for this

depends on if we are gunna grep logs or not. for this i don't think we need to - can prob just get away with the 2 getters... we'll see

@robrobbins robrobbins added the HODL Wait. Just. Wait. label Aug 14, 2019
@robrobbins robrobbins self-assigned this Aug 14, 2019
@rekibnikufesin
Copy link
Contributor Author

Does weird shit happen if we send more than 1 file? The code allows for it but it looks like the data_hash will be of the last file. 🤷‍♂️

Yeah, good catch. Weird shit would happen. The DB schema is only expecting one file and you're right about the data_hash.
I had only been thinking of one file per listing. If we need to support multiple files, I can change this to support it fairly easily.
Re: the data_hash- in the event of multiple files, should the data_hash be the hash of all uploaded files? I think it has to be- protocol doesn't support multiple values for the hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HODL Wait. Just. Wait.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants